import java.util.Scanner;

public class work2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的邮箱:");
        while(true){
            String  phone  = scanner.next();//xxxxxxx@xxxx.xxx
            if(phone.matches("\\w{1,30}@[a-zA-Z0-9]{2,20}(\\.[a-zA-Z0-9]{2,20}){1,2}")){
                System.out.println("输入正确");
                break;
            }else{
                System.out.println("格式有误，请重新输入:");
            }
        }
    }
}
